/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.ranch.api.security;

import java.util.Collection;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

/**
 *
 */
public class RanchUserDetails extends User{

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private org.ranch.model.User systemUser;

    /**
     * constructor with initial specified values
     *
     * @param username
     * @param password
     * @param enabled
     * @param accountNonExpired
     * @param credentialsNonExpired
     * @param accountNonLocked
     * @param authorities
     */
    public RanchUserDetails(org.ranch.model.User user, boolean enabled,
			boolean accountNonExpired, boolean credentialsNonExpired,
			boolean accountNonLocked,
			Collection<? extends GrantedAuthority> authorities) {
	super(user.getUsername(), user.getPassword(), enabled,
				accountNonExpired, credentialsNonExpired, accountNonLocked,
				authorities);

	systemUser = user;
    }

    /**
     * gets the salt of the user
     * @return
     */
    public String getSalt(){
        return systemUser.getSalt();
    }

    /**
     * Gets the system user
     * @return
     */
    public org.ranch.model.User getSystemUser() {
        return systemUser;
    }

    public void setSystemUser(org.ranch.model.User systemUser) {
        this.systemUser = systemUser;
    }
    
}
